


function read(){
    UI_ = currentActivity()
    console.log(UI_)

    if (f.ms({"text":"欢迎发表你的观点"})){
        console.log('欢迎发表你的观点', '在文章页')
        if( appinfo.read_state == 'read' ){

          var  nowTime = new Date().getTime()
          console.log('文章阅读中', 65 * 1000 - (nowTime - appinfo.video_see_time))
            if ( nowTime - appinfo.read_see_time > 65 * 1000 ){
                appinfo.read_state = 'see'
            }else{
                f.moveTo(appinfo.device.width*0.5, appinfo.device.height * 0.8, appinfo.device.width*0.5, appinfo.device.width * 0.3, 2000)
                sleep(f.rd(3000,8000))
            }
        }
        else
        {
            back()
        }
    }else
    if( f.ms({"id":"comm_head_xuexi_score"})  ){
        console.log('comm_head_xuexi_score', '主页面')
        if (appinfo.read_state == 'see'){
            f.ms({"id":"comm_head_xuexi_score"},true, 2)
        }else
        if ( appinfo.read_state == 'read' ){
            var title_id = id('general_card_title_id').find()
            if( title_id ){
                for(var i = 0; i < title_id.length; i++){
                    console.log(i, title_id[i].text())
        
                    if ( !appinfo.read_title_id.includes(title_id[i].text())){
                        appinfo.read_title_id.push(title_id[i].text())
                        f.setLocal('read_title_id', appinfo.read_title_id)
                        console.log('add title_id')
                        f.clickObj(title_id[i], 3, title_id[i].text())
                        appinfo.read_see_time = new Date().getTime()
                        break
                    }
        
                }
                f.moveTo(appinfo.device.width*0.5, appinfo.device.height * 0.8, appinfo.device.width*0.5, appinfo.device.width * 0.3, 2000)
            }
        }
    }else
    if ( f.ms({"text":"学习积分"})  ){
        console.log('comm_head_xuexi_score', '任务页面')
        if( appinfo.read_state == 'see' ){
            // console.log('点开查看分数')
            var res = text('我要选读文章').findOne(200)
            if ( res ){
                res = res.parent()
                var readinfo = son(res, false)
                if ( readinfo.length > 0 ){
                    console.log('任务进度', readinfo)
                    appinfo.read_times = readinfo[3][0]
                    console.log(`任务进度${appinfo.read_times}/${readinfo[4]}`)
                }
                if ( appinfo.read_times == '12' ){
                    appinfo.read_state = false
                    f.setLocal('read_state', appinfo.read_state)
                }else{
                    appinfo.read_state = 'read'
                    son(res, true)
                }
            }

        }else{ appinfo.read_state == 'read'}{
            back()
        }
    }else{
        f.ms({"text":"加入书架"},true, 2)
        back()
    }


}














module.exports = {
    read
};